home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Blitter / PixelTrail2.s < prev    next >
Encoding:
Text File  |  1998-05-07  |  4.0 KB  |  168 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This demo demonstrates the usefulness of LISTs, by drawing a trail of
  3. ;pixels attached to the mouse.
  4. ;
  5. ;Press LMB to exit.
  6.  
  7.     INCDIR    "GMSDev:Includes/"
  8.     INCLUDE    "dpkernel/dpkernel.i"
  9.  
  10.     SECTION    "Demo",CODE
  11.  
  12. ;===========================================================================;
  13. ;                             INITIALISE DEMO
  14. ;===========================================================================;
  15.  
  16.     STARTDPK
  17.  
  18. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  19.     move.l    DPKBase(pc),a6
  20.     lea    ScreenTags(pc),a0
  21.     sub.l    a1,a1
  22.     CALL    Init
  23.     tst.l    d0
  24.     beq.s    .Exit
  25.  
  26.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  27.     CALL    Get
  28.     move.l    d0,JoyData
  29.     beq.s    .Exit
  30.     move.l    d0,a0    ;Initialise the joydata structure.
  31.     sub.l    a1,a1
  32.     CALL    Init
  33.     tst.l    d0
  34.     beq.s    .Exit
  35.  
  36.     move.l    Screen(pc),a0
  37.     CALL    Display
  38.  
  39.     bsr.s    Main
  40.  
  41. .Exit    move.l    DPKBase(pc),a6
  42.     move.l    JoyData(pc),a0
  43.     CALL    Free
  44.     move.l    Screen(pc),a0
  45.     CALL    Free
  46.     MOVEM.L    (SP)+,A0-A6/D1-D7
  47.     moveq    #ERR_OK,d0
  48.     rts
  49.  
  50. ;===========================================================================;
  51. ;                                MAIN LOOP
  52. ;===========================================================================;
  53.  
  54. Main:    move.l    DPKBase(pc),a6
  55.     move.l    JoyData(pc),a0
  56.     CALL    Query
  57.     move.l    JoyData(pc),a0
  58.     lea    Mouse(pc),a2
  59.     move.w    JD_XChange(a0),d0
  60.     add.w    d0,(a2)
  61.     move.w    JD_YChange(a0),d0
  62.     add.w    d0,2(a2)
  63.  
  64.     move.l    JD_Buttons(a0),d0
  65.     btst    #JB_LMB,d0
  66.     bne.s    .done
  67.  
  68. .ChkLX    tst.w    (a2)
  69.     bge.s    .ChkRX
  70.     clr.w    (a2)
  71. .ChkRX    cmp.w    #319,(a2)
  72.     ble.s    .ChkTY
  73.     move.w    #319,(a2)
  74. .ChkTY    tst.w    2(a2)
  75.     bge.s    .ChkBY
  76.     clr.w    2(a2)
  77. .ChkBY    cmp.w    #255,2(a2)
  78.     ble.s    .Draw
  79.     move.w    #255,2(a2)
  80.  
  81. .Draw    lea    MList(pc),a3    ;Shift the list up a place.
  82.     moveq    #32-1,d7
  83. .tloop    move.l    PXL_SIZEOF(a3),PXL_XCoord(a3)
  84.     addq.w    #PXL_SIZEOF,a3
  85.     dbra    d7,.tloop
  86.  
  87.     move.l    BLTBase(pc),a6
  88.     move.l    Screen(pc),a0    ;a0 = Screen
  89.     move.l    GS_Bitmap(a0),a0    ;a0 = Bitmap
  90.     lea    PixelList(pc),a1    ;a1 = Pixel list.
  91.     CALL    bltDrawPixelList
  92.  
  93.     move.l    SCRBase(pc),a6
  94.     CALL    scrWaitAVBL
  95.     move.l    Screen(pc),a0
  96.     CALL    scrSwapBuffers
  97.     bra    Main
  98.  
  99. .done    rts
  100.  
  101. ;===========================================================================;
  102. ;                                  DATA
  103. ;===========================================================================;
  104.  
  105. JoyData:    dc.l  0
  106.  
  107. ScreenTags:    dc.l  TAGS_SCREEN
  108. Screen:        dc.l  0
  109.         dc.l  GSA_Attrib,SCR_DBLBUFFER
  110.         dc.l    GSA_BitmapTags,0
  111.         dc.l    BMA_Palette,.palette
  112.         dc.l    TAGEND,0
  113.         dc.l  TAGEND
  114.  
  115. .palette    dc.l  PALETTE_ARRAY,32
  116.         dc.l  $000000,$101010,$202020,$303030,$404040,$505050,$606060,$707070
  117.         dc.l  $808080,$909090,$a0a0a0,$b0b0b0,$c0c0c0,$d0d0d0,$e0e0e0,$f0f0f0
  118.         dc.l  $000000,$101010,$202020,$303030,$404040,$505050,$606060,$707070
  119.         dc.l  $808080,$909090,$a0a0a0,$b0b0b0,$c0c0c0,$d0d0d0,$e0e0e0,$ffffff
  120.  
  121. ;---------------------------------------------------------------------------;
  122.  
  123. PixelList:    dc.w  33,PXL_SIZEOF    ;Amount of entries.
  124.         dc.l  MList    ;Pointer to pixel list array.
  125. MList:        PIXEL 160,128,00    ;First pixel to draw (at back)
  126.         PIXEL 160,128,00    ;X/Y/Colour
  127.         PIXEL 160,128,01    ;..
  128.         PIXEL 160,128,02    ;..
  129.         PIXEL 160,128,03    ;..
  130.         PIXEL 160,128,04    ;..
  131.         PIXEL 160,128,05    ;..
  132.         PIXEL 160,128,06    ;..
  133.         PIXEL 160,128,07    ;..
  134.         PIXEL 160,128,08    ;..
  135.         PIXEL 160,128,09    ;..
  136.         PIXEL 160,128,10    ;..
  137.         PIXEL 160,128,11    ;..
  138.         PIXEL 160,128,12    ;..
  139.         PIXEL 160,128,13    ;..
  140.         PIXEL 160,128,14    ;..
  141.         PIXEL 160,128,15    ;..
  142.         PIXEL 160,128,16    ;..
  143.         PIXEL 160,128,17    ;..
  144.         PIXEL 160,128,18    ;..
  145.         PIXEL 160,128,19    ;..
  146.         PIXEL 160,128,20    ;..
  147.         PIXEL 160,128,21    ;..
  148.         PIXEL 160,128,22    ;..
  149.         PIXEL 160,128,23    ;..
  150.         PIXEL 160,128,24    ;..
  151.         PIXEL 160,128,25    ;..
  152.         PIXEL 160,128,26    ;..
  153.         PIXEL 160,128,27    ;..
  154.         PIXEL 160,128,28    ;..
  155.         PIXEL 160,128,29    ;..
  156.         PIXEL 160,128,30    ;..
  157. Mouse:        PIXEL 160,128,31    ;Last pixel to draw (in front)
  158.  
  159. ;===========================================================================;
  160.  
  161. ProgName:    dc.b  "Pixel Trail II",0
  162. ProgAuthor:    dc.b  "Paul Manias",0
  163. ProgDate:    dc.b  "February 1998",0
  164. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  165. ProgShort:    dc.b  "Pixel trail demonstration.",0
  166.         even
  167.  
  168.